
<div class="layui-btn-container mt15 mb15">

    <button type="button" class="layui-btn layui-btn-radius" onclick="refresh()">刷新</button>
    <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" data-open="system.admin/add" id="add">添加</button>
    <!-- <button type="button" class="layui-btn layui-btn-danger layui-btn-radius">删除</button> -->

</div>

<table class="layui-table">
    <colgroup>
      <col width="50">
      <col width="50">
      <col width="80">
      <col width="60">
      <col width="110">
      <col width="60">
      <col width="110">
      <col width="40">
      <col width="80">
      <col width="130">
      <col>
    </colgroup>
    <thead>
      <tr>
        <th>ID</th>
        <th>排序</th>
        <th>登录账户</th>
        <th>头像</th>
        <th>手机</th>
        <th>登录次数</th>
        <th>备注信息</th>
        <th>状态</th>
        <th>创建时间</th>
        <th>操作</th>
      </tr> 
    </thead>
    <tbody>
        {volist name='admin_list' id='vo'}
            <tr>
                <td>{$vo.id}</td>
                <td>{$vo.sort}</td>
                <td>{$vo.username}</td>
                <td><img src="{$vo.head_img}" style="width:60px;height:60px"></td>
                <td>{$vo.phone}</td>
                <td>{$vo.login_num}</td>
                <td>{$vo.remark}</td>
                <td>{$vo.status}</td>
                <td>{$vo.create_time}</td>
                <td>
                  <div class="layui-btn-group">
                    <button type="button" class="layui-btn layui-btn-sm layui-bg-blue js-open" data-id="{$vo.id}">编辑</button>
                    <button type="button" class="layui-btn layui-btn-sm ">设置密码</button>
                    <button type="button" class="layui-btn layui-btn-sm layui-bg-red">删除</button>
                  </div>
                </td>

            </tr>
        {/volist}

    </tbody>
  </table>
  
  <script>

    var refresh = ()=>{
      window.location.href="{:url('system.admin/index')}";
    }

    $(function(){

      $("#add").on("click",function(){

        layer.open({
          type: 2,
          //offset:"t",
          area: ['900px', '520px'],
          title:"添加",
          content: "{:url('system.admin/add')}",
          fixed: false, // 不固定
          maxmin: true,
          shadeClose: true,
        });
      })


      $(".js-open").on("click",function(){
        var id = $(this).attr("data-id");

        layer.open({
          type: 2,
          //offset:"t",
          area: ['900px', '520px'],
          title:"编辑",
          content: "{:url('/system.admin/edit/id/"+id+"')}",
          fixed: false, // 不固定
          maxmin: true,
          shadeClose: true,
        });


      })


  })

  </script>